﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace 单元测试_CurrencyService
{
    public class AccountService : IAccountService
    {
        private readonly ICurrencyService currencyService;

        public AccountService(ICurrencyService currencyService)
        {
            this.currencyService = currencyService;
        }

        public void TransferFunds(Account from, Account to, double amount)
        {
            from.Withdraw(amount);
            double conversionRate = currencyService.GetConversionRate(from.Currency, to.Currency);
            double convertedAmount = amount * conversionRate;
            to.Deposit(convertedAmount);
        }
    }
}